<template>
  <tfoot>
    <tr>
      <td colspan="5">
        <span>总分：{{ totalScore }}</span>
        <span style="margin-left: 50px">平均分：{{ average }}</span>
      </td>
    </tr>
  </tfoot>
</template>

<script>
export default {
  // 获取
  props: {
    list: {
      type: Array,
      required: true
    }
  },
  computed: {
    // 计算总分
    totalScore(){
      return this.list.reduce((sum, item)=> sum + item.score, 0)
    },
    // 使用总分计算平均分
    average(){
      return (this.totalScore / this.list.length).toFixed(2)
    }
  }
}
</script>

<style></style>
